package org.lisen.controlleradvice.controller;

import org.lisen.controlleradvice.entity.Person;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

/**
 * @author laughing
 * @date 2020/9/27
 * @site https://www.lisen.org
 */
@RestController
public class TestGlobalDataBinderController {

    @ModelAttribute
    @RequestMapping("/testGlobalDataBinderController")
    public Person testGlobalDataBinderController(@RequestParam("name") String name, @RequestParam("birthday")Date birthday){
        Person person = new Person();
        person.setBirthday(birthday);
        person.setName(name);
        return person;
    }

    @ModelAttribute
    @RequestMapping("/testGlobalDataBinderControllerBody")
    public Person testGlobalDataBinderControllerBody(@RequestBody Person person){
        return person;
    }

}
